package com.borrowed.book.book.service.impl;

import com.borrowed.book.book.domain.SHomepageImg;
import com.borrowed.book.book.domain.SelectHomeImgInDto;
import com.borrowed.book.book.domain.UpdHomeImgStatusInDto;
import com.borrowed.book.book.mapper.SHomepageImgMapper;
import com.borrowed.book.book.service.HomepageImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class HomepageImgServiceImp implements HomepageImgService {
    @Autowired
    private SHomepageImgMapper homepageImgMapper;
    /**
     * 首页图片添加
     *
     * @param param
     */
    @Override
    public void AddHomepageImg(SHomepageImg param) {
        param.setCreateTime(new Date());
        homepageImgMapper.insert(param);
    }

    /**
     * 首页图片更新
     *
     * @param param
     */
    @Override
    public void UpdateHomepageImg(SHomepageImg param) {
        homepageImgMapper.update(param);
    }

    /**
     * 启用禁用图片
     *
     * @param param
     */
    @Override
    public void UpdateHomepageImgStatus(UpdHomeImgStatusInDto param) {
        homepageImgMapper.updateStatus(param);
    }

    /**
     * 删除图片
     *
     * @param id
     */
    @Override
    public void deleteHomepageImg(Long id) {
        homepageImgMapper.delete(id);
    }

    /**
     * 一览查询
     */
    @Override
    public List<SHomepageImg> selectHomepageImg(SelectHomeImgInDto param) {
        List<SHomepageImg> list=homepageImgMapper.select(param);
        return list;
    }
}
